#ifndef IODEVICE_H_INCLUDED
#define IODEVICE_H_INCLUDED

#include <string>
#include <stdexcept>

#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>

namespace Common {

class InputDeviceException : public std::runtime_error {
public :
	InputDeviceException(const std::string & msg) : runtime_error(msg) { }
};
	
/**
 * Abstraction for File IO implementation
 */
class IInputDevice {
public :
	IInputDevice() { }
	virtual ~IInputDevice() { }	
	
	virtual boost::int64_t expectedSize() const = 0;
	virtual std::size_t readBlock(char * buf, boost::int64_t from, boost::int64_t to) 
		throw (InputDeviceException) = 0;
	virtual std::size_t readSome(char * buf, std::size_t bufferSize) = 0;

};

typedef boost::shared_ptr<IInputDevice> IInputDevicePtr;

} // namespace common

#endif

